package com.ybu.oodd.utils.code;


import java.util.Random;

public class CodeUtils {

    /**
     * 生成指定位数的数字验证码
     */
    public static String generateCode(int length) {
        Random random = new Random();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < length; i++) {
            sb.append(random.nextInt(10)); // 0-9
        }
        return sb.toString();
    }
}